new Vue({
    el: "#app",
    data: {
        username: 'admin',
        password: '123456'
    },
    methods: {
        login() {

            //--------------post表单-----------
            let params = new URLSearchParams()
            params.append("username", this.username);
            params.append("password", this.password);
            axios.post('/login', params).then(res => {
                console.log(res.data);
            })


            //--------------get-----------
            // axios.get('/login?username=' + this.username + "&password=" + this.password).then(res => {
            //     console.log(res.data);
            // })


            //--------------post  json-----------
            // let data = {
            //     username: this.username,
            //     password: this.password
            // }
            // axios.post('/login', data).then(res => {
            //     console.log(res.data);
            // })
        }
    }
});